package com.xuanwei.web.controller;

import com.xuanwei.core.response.ResultVO;
import com.xuanwei.core.service.IXwHelpContentService;
import com.xuanwei.core.service.IXwHelpService;
import com.xuanwei.dao.entity.XwHelp;
import com.xuanwei.dao.entity.XwHelpContent;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @Author jiangyong
 * @Description TODO
 * @Date 2019/8/28 16:13
 **/
@RestController
@RequestMapping("/wx/help")
public class HelpController extends BasicController {

    private IXwHelpService helpService;

    private IXwHelpContentService helpContentService;

    public HelpController(IXwHelpService helpService,
                          IXwHelpContentService helpContentService) {
        this.helpService = helpService;
        this.helpContentService = helpContentService;
    }

    @RequestMapping(value = "list", method = RequestMethod.GET)
    public ResultVO list() {
        List<XwHelp> all = helpService.findAll(0);
        return ResultVO.successResult(all);
    }

    @RequestMapping(value = "content", method = RequestMethod.GET)
    public ResultVO listByHelpId(Integer id) {
        List<XwHelpContent> all = helpContentService.findAll(id, 0);
        return ResultVO.successResult(all);
    }
}
